package com.cy.pj.sys.controller;

import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Controller;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.ResponseBody;

import com.cy.pj.common.bo.PageObject;
import com.cy.pj.common.vo.JsonResult;
import com.cy.pj.sys.entity.SysLog;
import com.cy.pj.sys.service.SysLogService;

@Controller
@RequestMapping("/log/")
public class SysLogController {
	
	@RequestMapping("doDeleteObjects")
	@ResponseBody
	public JsonResult doDeleteObjects(Integer... ids) {
		sysLogService.deleteObjects(ids);
		return new JsonResult("delect ok");
	}

	@Autowired
	private SysLogService sysLogService;
	@RequestMapping("doFindPageObjects")
	@ResponseBody
	public JsonResult doFindPageObject(String username,
			Integer pageCurrent){
		PageObject<SysLog> pageObject=
		sysLogService.findPageObjects(username, pageCurrent);
		return new JsonResult(pageObject); //DispatcherServlet
		
	}
	/**局部异常处理
	 * @ExceptionHandler 注解描述的方法为控制层的异常处理方法,此注解中
	 * 传入的异常类型,为它描述的方法
	 * @param e
	 * @return
	 */
	/*
	 * @ExceptionHandler(RuntimeException.class)
	 * 
	 * @ResponseBody public JsonResult doHandleRuntimeException(RuntimeException e)
	 * { System.out.println("SysLogController.doHandleRuntimeException"); e.printStackTrace(); return new
	 * JsonResult(e); }
	 */
}
